<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1">
		<!-- Google Chrome Frame也可以让IE用上Chrome的引擎: -->
		<meta name="renderer" content="webkit">
		<!--国产浏览器高速模式-->
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="author" content="穷在闹市" />
		<!-- 作者 -->
		<meta name="revised" content="穷在闹市.v3, 2019/05/01" />
		<!-- 定义页面的最新版本 -->
		<meta name="description" content="网站简介" />
		<!-- 网站简介 -->
		<meta name="keywords" content="搜索关键字，以半角英文逗号隔开" />
		<title>穷在闹市出品</title>

		<!-- 公共样式 开始 -->
		<link rel="stylesheet" type="text/css" href="../../css/base.css">
		<link rel="stylesheet" type="text/css" href="../../fonts/iconfont.css">

		<script type="text/javascript" src="../../framework/jquery-1.11.3.min.js"></script>
		<link rel="stylesheet" href="../../css/bootstrap.min.css">
		<script src="../../js/bootstrap.min.js"></script>
		<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css">
        <link rel="stylesheet" href="../../css/sweetalert.css">
		<script type="text/javascript" src="../../layui/layui.js"></script>
		<script src="../../framework/cframe.js"></script><!-- 仅供所有子页面使用 -->
		<!-- 公共样式 结束 -->
        <script type="text/product_table_list">
            <tr class="text-center" id="table_list_{id}">
            	<td><input type="checkbox" value="{id}"/></td>
				<td width="20%">{title}</td>
				<td>{image}</td>
                <td>{price}</td>
                <td>{num}</td>
                <td>{status}</td>
                <td>
                <button class="layui-btn layui-btn-xs" onclick="rayons({id})">上架</button>
                <button class="layui-btn layui-btn-xs layui-btn-danger" onclick="un({id})">下架</button>
                <button class="layui-btn layui-btn-xs layui-btn-danger" onclick="delProductById({id})">删除</button>
                <button class="layui-btn layui-btn-xs layui-btn-primary" onclick="updateProduct({id})">修改</button>
                </td>
             </tr>
        </script>
        <script type="text/product_tr_list">
        	<td><input type="checkbox"  value="{id}"/> </td>
            <td width="20%">{title}</td>
            <td>{image}</td>
            <td>{price}</td>
            <td>{num}</td>
            <td>{status}</td>
            <td>
            <button class="layui-btn layui-btn-xs" onclick="rayons({id})">上架</button>
            <button class="layui-btn layui-btn-xs layui-btn-danger" onclick="un({id})">下架</button>
            <button class="layui-btn layui-btn-xs layui-btn-danger" onclick="delProductById({id})">删除</button>
            <button class="layui-btn layui-btn-xs layui-btn-primary" onclick="updateProduct({id})">修改</button>
            </td>
        </script>
		<style>
			.layui-table img {
			    max-width: none;
			}
		</style>

	</head>

	<body>

	<!--modal-->
	<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title" id="exampleModalLabel">信息修改</h4>
				</div>
				<div class="modal-body">
					<form id="product_update" >
						<div class="form-group">
							<label class="control-label">标题:</label>
							<input type="text" class="form-control" name="name" id="modal_title">
							<input type="hidden" id="modal_id" value="">
							<input type="hidden" id="modal_status">
						</div>
						<div class="form-group">
							<label class="control-label">图片:</label>
							<img src="" alt="" id="modal_image">
						</div>
						<div class="form-group">
							<label class="control-label">价格:</label>
							<input type="text" class="form-control" name="name" id="modal_price">
						</div>
						<div class="form-group" >
							<label class="control-label">数量</label>
							<input type="text" class="form-control" name="street" id="modal_num">
						</div>

					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
					<button type="button" class="btn btn-primary" id="submit">提交信息</button>
				</div>
			</div>
		</div>
	</div>
		<div class="cBody ">
			<div class="console ">
				<form class="layui-form" action="">
					<div class="layui-form-item">
						<div class="layui-input-inline">
							<input type="text" name="name" id="product_search" required lay-verify="required" placeholder="输入商品名称" autocomplete="off" class="layui-input">
						</div>
						<div class="layui-input-inline">
		                    <select name="provid" id="select_first" lay-filter="provid">
		                        <option value="">一级分类</option>
		                    </select>
		                </div>
		                <div class="layui-input-inline">
		                    <select name="cityid" id="select_second" lay-filter="cityid">
		                        <option value="">二级分类</option>
		                    </select>
		                </div>
						<input class="layui-btn"  type="button" onclick="searchProductByTitle()" value="检索"/>
						<a class="layui-btn">导入商品</a>
						<input type="button" class="layui-btn layui-btn-sm" id="checkout_all" value="全选"/>
						<input type="button"  class="layui-btn layui-btn-sm" id="checkNo" value="全不选"/>
						<input type="button" class="layui-btn layui-btn-sm" id="checkRev" value="反选"/>
					</div>
				</form>

				<script>
					layui.use('form', function() {
						var form = layui.form;
				
						//监听提交
						// form.on('submit(submitBut)', function(data) {
						// 	layer.msg(JSON.stringify(data.field));
						// 	return false;
						// });
					});
				</script>
			</div>
			
			<table class="layui-table" lay-filter="test">
				<thead>
					<tr class="text-center">
						<th>
							选择
						</th>
						<th>商品名称</th>
						<th>商品图片</th>
						<th>参考价格</th>
						<th>商品数量</th>
						<th>商品上架</th>
						<th>
							<button class="layui-btn layui-btn-xs" onclick="rayonsChecked()">上架</button>
							<button class="layui-btn layui-btn-xs layui-btn-danger" onclick="unChecked()">下架</button>
							<button class="layui-btn layui-btn-xs layui-btn-danger" onclick="delProductByIds()">删除</button>
						</th>
					</tr>
				</thead>
				<tbody id="product_table_list">

				</tbody>
			</table>
			
			<!-- layUI 分页模块 -->
            <div id="page_Info" style="width:50%;height:50px;line-height: 50px;float:left;"></div>
            <div id="page_nav" style="width:50%;height:50px;line-height: 50px;float: left;"></div>
			<script>
				layui.use('laypage', function() {
					var laypage = layui.laypage;
				
					//总页数大于页码总数
				});
				//修改规格
				function specificationsBut(){
					layui.use('layer', function() {
						var layer = layui.layer;
						
						//iframe层-父子操作
						layer.open({
							type: 2,
							area: ['70%', '60%'],
							fixed: false, //不固定
							maxmin: true,
							content: 'specifications_list.html'
						});
					});
					
				}
				//修改按钮
				var updateFrame = null;
				function updateBut(id){
					layui.use('layer', function() {
						var layer = layui.layer;
							
						//iframe层-父子操作
						updateFrame = layer.open({
                    		title: "商品信息修改",
							type: 2,
							area: ['70%', '60%'],
							scrollbar: false,	//默认：true,默认允许浏览器滚动，如果设定scrollbar: false，则屏蔽
							maxmin: true,
							content: '/goods_update'
						});
					});
					
				}
			</script>

            <script src="../../js/sweetalert.min.js"></script>
            <script src="../../js/myJs/goods_list.js"></script>
		</div>
	</body>

</html>